package com.situ.student.service.impl;

import com.situ.student.dao.StudentDao;
import com.situ.student.dao.impl.StudentDaoImpl;
import com.situ.student.model.Student;
import com.situ.student.model.search.StudentSearchBean;
import com.situ.student.service.StudentService;
import com.situ.student.util.BeanFactory;
import com.situ.student.util.Pagination;

import java.util.List;

//业务类
public class StudentServiceImpl implements StudentService {
    private final StudentDao studentDao = BeanFactory.getBean(StudentDaoImpl.class);

    @Override
    public List<Student> findAll(Pagination pagination, StudentSearchBean ssb) {
        return studentDao.findAll(pagination, ssb);
    }

    @Override
    public int deleteByIds(List<Integer> ids) {
        return studentDao.deleteByIds(ids);
    }

    @Override
    public boolean save(Student student) {
        return studentDao.save(student) == 1;
    }

    @Override
    public boolean update(Student student) {
        return studentDao.update(student) == 1;
    }

    @Override
    public Student findById(Integer id) {
        return studentDao.findById(id);
    }
}
